#include<iostream>
#include<vector>
#include<deque>
#include<unordered_map>
using namespace std;

struct Ship {
    int time;
    vector<int> ct;
};

void run(deque<Ship> &q, Ship sp, unordered_map<int,int>& passengerCount) {
    // 删除过期船只
    while(!q.empty() && sp.time - q.front().time >= 86400) {
        for(int p : q.front().ct) {
            passengerCount[p]--;
            if(passengerCount[p] == 0) {
                passengerCount.erase(p);
            }
        }
        q.pop_front();
    }
    
    // 添加新船
    q.push_back(sp);
    for(int p : sp.ct) {
        passengerCount[p]++;
    }
    
    cout << passengerCount.size() << endl;
}

int main() {
    deque<Ship> q;
    unordered_map<int,int> passengerCount;
    int n;
    cin >> n;
    while(n--) {
        Ship sp;
        int t, m;
        cin >> t >> m;
        sp.time = t;
        sp.ct.resize(m);
        for(int i = 0; i < m; i++) {
            cin >> sp.ct[i];
        }
        run(q, sp, passengerCount);
    }
    return 0;
}